<template>
  <div class="select-view">
    <div class="block" v-for="(item,index) in option" :key="index">
      <div class="select-item" :class="{'selected':index===select}" @click="checkItem(index)">{{ item }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TabCheck',
  props: {
    option: {
      type: Array,
      default: function () {
        return []
      }
    },
    select: {
      type: Number,
      default: -1
    }
  },
  model: {
    prop: 'select',
    event: 'changeNumber',
  },
  methods: {
    checkItem (index) {
      this.$emit('changeNumber', index)
    }
  }
}
</script>

<style lang="scss" scoped>
.select-view {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;

  .block {
    display: flex;
    width: 33%;
    height: 35px;
    font-size: 13px;
    margin-bottom: 8px;

    .select-item {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 92%;
      height: 85%;
      margin: auto;
      border-radius: 2px;
      border: 1px solid #E7E7E7;
      color: #252525;
    }

    .select-item.selected {
      border-color: #FA472F;
    }
  }
}
</style>
